Skip to content

Conversation

siverne
Copy link
Member

@siverne siverne commented Nov 19, 2026 •

Closes #68.

The filter checkboxes did not look ticked right after a click. On the VM, right after clicking «Rødvin» the URL was already ?type=rodvin, but the checkbox was not ticked. It was ticked about 18 ms later.

Why: React Router changes the URL in a transition. The checkbox is controlled by the URL, so until the transition commits, React puts it back the way it was. Playwright checks at once, so check() failed on desktop and mobile. A screen reader does the same, and announces «ikke avkrysset» when the user presses Space. That is probably why a peer reviewer wrote that the filters could not be used with the keyboard.

Fix: SearchPage keeps the choice in local state, which React applies before it restores a controlled input, so the checkbox and the sort select change at once. The queries still follow the URL, and the local state is reset every time the URL changes (back button, «Nullstill filtre», removing a filter), so the URL stays the truth.

useOptimistic was tried first, but it did not show the choice soon enough to beat the restore.

Tested: npm run check passes, and all e2e tests pass (80 passed, 2 skipped, which are the mobile-only tests in the desktop project). The test that failed in #68 now passes on desktop and mobile. Also tried by hand on the search page.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@siverne siverne requested a review from a team as a code owner November 19, 2026 16:30
Copy link
Member

@manerlan manerlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, seems good. Ran npm run check, and all checks passed. Approving.

@manerlan manerlan merged commit d155769 into main Nov 19, 2026
@manerlan manerlan deleted the 68-filter-checkbox branch November 19, 2026 16:36
@manerlan
Copy link
Member

Realised that the test-results/.last-run.json file should not have been merged into main, will remove it and commit the change whilst working on issue #73 .

@manerlan manerlan mentioned this pull request Nov 19, 2026
3 tasks
@manerlan
Copy link
Member

Realised that the test-results/.last-run.json file should not have been merged into main, will remove it and commit the change whilst working on issue #73 .

The problem was that some parts of .gitignore only existed in an own .gitignore in /frontend. Added those parts to the .gitignore in the root folder, and removed the one in /frontend in #95 .

Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E2E: checking "Rødvin" in the filter dialog fails on mobile
2 participants